﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RL
{
    public class DataBindingArgs : EventArgs
    {
        /// <summary>
        /// Initialize
        /// </summary>
        public DataBindingArgs(string whereClause, string orderbyClause, int pageIndex, int pageSize, params object [] extras)
        {
            this.WhereClause = whereClause;
            this.OrderBy = orderbyClause;
            this.PageIndex = pageIndex;
            this.PageSize = pageSize;
            this.Extras = extras;
        }

        /// <summary>
        /// Set data in the DataBindingEvent so that the data binding control can use the data.
        /// </summary>
        /// <param name="data"></param>
        /// <param name="virtualItemCount"></param>
        /// <param name="extras"></param>
        public void SetData(object data, int virtualItemCount, params object[] extras)
        {
            this.Data = data;
            this.VirtualCount = virtualItemCount;
            this.Extras = extras;
        }

        /// <summary>
        /// Data to bind
        /// <example>Product[]</example>
        /// </summary>
        public object Data { get; set; }

        /// <summary>
        /// <example>ItemName ASC</example>
        /// </summary>
        public string OrderBy { get; set; }

        /// <summary>
        /// <example>ItemName = 'pine-apple'</example>
        /// </summary>
        public string WhereClause { get; set; }

        /// <summary>
        /// Visible items on one page
        /// <example>100</example>
        /// </summary>
        public int PageSize { get; set; }

        /// <summary>
        /// The zero based index
        /// </summary>
        public int PageIndex { get; set; }

        /// <summary>
        /// Number of total records
        /// </summary>
        public int VirtualCount { get; set; }

        /// <summary>
        /// Extra data to send to the client
        /// </summary>
        public object[] Extras { get; set; }        
        
    }
}